package Demo04;

import javax.swing.*;
import java.awt.*;

public class BorTest_Code extends JFrame {
    private  JPanel mainPanel;
    private JButton btn1,btn2,btn3,btn4,btn5;

    public  BorTest_Code(){
        mainPanel=new JPanel(new BorderLayout());
        btn1 =new JButton("east");
        btn2 =new JButton("south");
        btn3 =new JButton("west");
        btn4 =new JButton("north");
        btn5 =new JButton("center");


        //铺面板
        setContentPane(mainPanel);

        mainPanel.add(btn1,"East");
        mainPanel.add(btn2,"South");
        mainPanel.add(btn3,"West");
        mainPanel.add(btn4,"North");
        mainPanel.add(btn5,"Center");

        setBounds(200,200,500,400);
        setVisible(true);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
    }

    public static void main(String[] args) {
        new  BorTest_Code();
    }
}
